<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
  <title>Description of diffTracker</title>
  <meta name="keywords" content="diffTracker">
  <meta name="description" content="Fast, robust estimation of translation/scale change between two images.">
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta name="generator" content="m2html &copy; 2003 Guillaume Flandin">
  <meta name="robots" content="index, follow">
  <link type="text/css" rel="stylesheet" href="../m2html.css">
</head>
<body>
<a name="_top"></a>
<!-- menu.html images -->
<h1>diffTracker
</h1>

<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>Fast, robust estimation of translation/scale change between two images.</strong></div>

<h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>function [delta,err] = diffTracker( I0, I1, sig, ss ) </strong></div>

<h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="fragment"><pre class="comment"> Fast, robust estimation of translation/scale change between two images.

 Approximates the translational offset between two images by assuming the
 images lie on linear manifold. Specifically, assumes that if I0 and I1
 are a pair of images related by a translation [dx dy], then (I0+I1)/2 is
 the image exactly halfway between I0 and I1 (ie I0 translated by [dx/2
 dy/2]). The above only holds for small translations and spatially smooth
 images. As such the input images typically need to be spatially smoothed
 first, the amount of necessary smoothing will increase as the size of
 translation increases (experiment for best results). The code is quite
 fast, the bottleneck is the spatial smoothing.

 The actual computation is performed as follows. First we generate an
 artificial translation of I0 by 1 pixel in x and y, and store the results
 in Tx and Ty. Also, if ss&gt;1, we generate an artificial scaling Ts of I0
 by upsampling by a factor of ss. The linearity assumption tells us that:
  I1 = I0 + (I0-Tx) * dx + (I0-Ty) * dy +  (I0-Ts) * ds
 Only dx, dy and possibly ds are unknown in the resulting overcomplete set
 of linear equations, least squares is then used. The error of the
 estimate can be used as a measure of the quality of the linear fit.

 This function was inspired by the beautiful work ok Yang et al.:
   H. Yang, M. Pollefeys, G. Welch, J. Frahm, and A. Ilie. Differential
   camera tracking through linearizing the local appearance manifold.
   CVPR, 2007.

 USAGE
  [delta,err] = diffTracker( I0, I1, [sig], [ss] )

 INPUTS
  I0       - reference grayscale double image
  I1       - translated version of I0
  sig      - [0] amount of Gaussian spatial smoothing to apply
  ss       - [0] scale step for artificial scaling (if &gt;1)

 OUTPUTS
  delta    - estimated dx/dy/ds
  err      - squared error of estimate

 EXAMPLE - translation only
  I = double(imread('cameraman.tif'))/255; dx=3; dy=5;
  I0=I(1+dy:end,1+dx:end); figure(1); im(I0);
  I1=I(1:end-dy,1:end-dx); figure(2); im(I1);
  tic, [delta,err] = diffTracker( I0, I1, 10 ), toc

 EXAMPLE - translation and scale
  I0 = double(imread('coins.png'))/255; dx=9; dy=-2; ds=1.10;
  H1 = [eye(2)*ds -[dy; dx]; 0 0 1];
  I1 = imtransform2(I0,H1,'bilinear','crop');
  tic, [ds,err] = diffTracker( I0, I1, 25, 1.05 ), toc
  H2 = [eye(2)*ds(3) -[ds(2); ds(1)]; 0 0 1];
  I2 = imtransform2(I0,H2,'bilinear','crop');
  figure(1); im(I0); figure(2); im(I1); figure(3); im(I2);
 
 See also

 Piotr's Image&amp;Video Toolbox      Version 2.53
 Copyright 2010 Piotr Dollar.  [pdollar-at-caltech.edu]
 Please email me if you find bugs, or have suggestions or questions!
 Licensed under the Lesser GPL [see external/lgpl.txt]</pre></div>

<!-- crossreference -->
<h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
This function calls:
<ul style="list-style-image:url(../matlabicon.gif)">
<li><a href="../filters/filterGauss.html" class="code" title="function G = filterGauss( dims, mu, C, show )">filterGauss</a>	n-dimensional Gaussian filter.</li><li><a href="imResample.html" class="code" title="function B = imResample( A, varargin )">imResample</a>	Fast bilinear image downsampling/upsampling.</li><li><a href="../matlab/arrayToDims.html" class="code" title="function IC = arrayToDims( I, dims, padEl )">arrayToDims</a>	Pads or crops I appropriately so that size(IC)==dims.</li></ul>
This function is called by:
<ul style="list-style-image:url(../matlabicon.gif)">
</ul>
<!-- crossreference -->




<!-- Start of Google Analytics Code -->
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-4884268-1");
pageTracker._initData();
pageTracker._trackPageview();
</script>
<!-- end of Google Analytics Code -->

<hr><address>Generated by <strong><a href="http://www.artefact.tk/software/matlab/m2html/" target="_parent">m2html</a></strong> &copy; 2003</address>
</body>
</html>
